package com.heima.wemedia.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.ChannelDto;
import com.heima.model.wemedia.pojos.WmChannel;
import com.heima.wemedia.service.WmChannelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * ClassName:WmchannelController
 * Package:com.heima.wemedia.controller.v1
 * Description:
 *
 * @Author: zongyu
 * @Create: 2024/3/4 - 15:58
 */
@RestController
@RequestMapping("api/v1/channel")
public class WmchannelController {
    @Autowired
    private WmChannelService wmChannelService;
    @GetMapping("/channels")
    public ResponseResult findAll(){
        return wmChannelService.findAll();
    }
    @DeleteMapping("/del/{id}")
    public ResponseResult delete(@PathVariable Integer id){
        return wmChannelService.delete(id);
    }
    @PostMapping("/list")
    public ResponseResult getList(@RequestBody ChannelDto dto){
        return wmChannelService.getList(dto);
    }
    @PostMapping("/save")
    public ResponseResult saveChannel(@RequestBody WmChannel wmChannel){
        return wmChannelService.saveChannel(wmChannel);
    }
    @PostMapping("/update")
    public ResponseResult updateChannel(@RequestBody WmChannel wmChannel){
        return wmChannelService.updateChannel(wmChannel);
    }
}
